Package edu.claflin.finder.logic.cond
Class BipartiteCondition
- java.lang.Object
-
- edu.claflin.finder.logic.Condition
-
- edu.claflin.finder.logic.cond.BipartiteCondition
-
public class BipartiteCondition extends Condition
Represents a bipartite graph as a Condition object. Used to test for bipartiteness.- Version:
- 1.1.1 May 26, 2015
- Author:
- Charles Allen Schultz II
-
-
Constructor Summary
Constructors Constructor Description BipartiteCondition()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleansatisfies(Graph existingGraph)Used to test if the supplied graph is within the bounds of the condition's implementation.private booleansatisfies(Graph existingGraph, java.util.Set<Node> addSet, java.util.Set<Node> compareSet, Node current)Private method for stepping through the adjacency lists and determining if the graph is bipartite.
-
-
-
Method Detail
-
satisfies
public boolean satisfies(Graph existingGraph)
Used to test if the supplied graph is within the bounds of the condition's implementation.Checks to determine if the supplied graph is Bipartite.
-
satisfies
private boolean satisfies(Graph existingGraph, java.util.Set<Node> addSet, java.util.Set<Node> compareSet, Node current)
Private method for stepping through the adjacency lists and determining if the graph is bipartite. Specifically, it uses a Depth-First model for exploring the node tree and sorting the nodes into two groups. If it successfully sorts the nodes into two groups with no invalidating edges, it returns true.- Parameters:
existingGraph- the Graph object to test against.addSet- the current set to add a node to based on the previous.compareSet- the current set to add adjacent nodes to.current- the current Node being compared.- Returns:
- true if the structure could be bipartite.
-
-